package pay

import (
	"context"
	"go.mongodb.org/mongo-driver/bson"
	"go.mongodb.org/mongo-driver/mongo/options"
)

func (p *Payment) FindByID(ctx context.Context) error {
	filter := bson.D{{"_id", p.ID}}
	return p.findOne(ctx, filter)
}

func (p *Payment) findOne(ctx context.Context, filter bson.D, opts ...*options.FindOneOptions) error {
	return p.GetCollection().FindOne(ctx, filter, opts...).Decode(p)
}
